package org.javaboy.demo.dao;

import org.apache.ibatis.annotations.Param;
import org.javaboy.demo.model.User;

import java.util.List;

public interface UserMapper {
    int addUser(User user);

    List<User> getALl();

    /**
     * 用户传入了 username 就按照 username 查询
     * 用户传入了 address 就按照 address 查询
     * 两个都传入，就按照两个条件查询
     * 都没传，那么就查询所有
     * @param username
     * @param address
     * @return
     */
    List<User> getUserByUsernameAndAddress(@Param("username") String username, @Param("address") String address);

    int updateUser(User user);

    List<User> getAllUsers(String username);

    List<User> getUsersByIds(List<Integer> ids);

    List<User> getUserByFirstName(String name);
    List<User> getUserByFirstName2(String name);
}
